<template>
  <div class="container">
    <dv-full-screen-container>
      <dv-border-box-11 title="火灾应急指挥中心">
        <div style="display: flex;width: 100%;height: 100%">
          <!--左边的-->
          <div class="left">

          </div>
          <!--中间的-->
          <div class="center">

          </div>

          <!--右边的-->
          <div class="right">

          </div>
        </div>

        <!--时间显示-->
        <div class="timer">
          <span class="date">{{yy}}</span><span class="date">年</span>
          <span class="date">{{mm}}</span><span class="date">月</span>
          <span class="date">{{dd}}</span><span class="date">日</span>
          <span class="date">{{hh}}</span><span class="date">:</span>
          <span class="date">{{mf}}</span><span class="date">:</span>
          <span class="date">{{ms}}</span>
          <span class="date">星期</span><span class="date">{{nowWeek}}</span>
        </div>
      </dv-border-box-11>
    </dv-full-screen-container>
  </div>
</template>

<script>
  export default {
    name: "firePicture",
    data() {
      return {
        color1: '#071022',
        nowWeek: '', // 当前星期
        yy: '',//年
        mm: '',//月
        dd: '',//日
        hh: '',//时
        mf: '',//分
        ms: '',//秒

      }
    },
    created() {
      this.currentTime()
    },
    mounted() {

    },
    methods: {
      /**
       * 每0.5秒执行一次
       */
      currentTime() {
        setInterval(this.getDate, 500)
      },
      /**
       * 获取当前日期时间的方法
       */
      getDate() {
        var _this = this
        //获取年
        let yy = new Date().getFullYear()
        //获取月,注意时间是0-11，0代表1月份
        let mm = new Date().getMonth() + 1
        // 获取具体哪一天
        let dd = new Date().getDate()
        // 获取星期 0-6 0是星期天
        let week = new Date().getDay()
        //获取小时
        let hh = new Date().getHours()
        //获取秒钟
        let ms = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
        // 获取分钟
        let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
        // 获取星期
        if (week == 1) {
          this.nowWeek = '一'
        } else if (week == 2) {
          this.nowWeek = '二'
        } else if (week == 3) {
          this.nowWeek = '三'
        } else if (week == 4) {
          this.nowWeek = '四'
        } else if (week == 5) {
          this.nowWeek = '五'
        } else if (week == 6) {
          this.nowWeek = '六'
        } else {
          this.nowWeek = '日'
        }
        _this.nowTime = hh + ':' + mf + ':' + ms
        _this.nowDate = yy + '年' + mm + '月' + dd + '日'
        _this.yy = yy
        _this.mm = mm
        _this.dd = dd
        _this.hh = hh
        _this.mf = mf
        _this.ms = ms
      },
    }
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
  }

  .container {
    width: 100%;
    height: 100%;
    background-color: #14315B;
  }

  .timer {
    font-size: 16px;
    position: absolute;
    top: 7px;
    right: 50px;
  }

  .timer .date:nth-child(odd) {
    color: #2FA5FF;
  }

  .timer .date:nth-child(even) {
    color: #C1C3C8;
  }

  .timer .date:nth-child(6) {
    margin-right: 10px;
  }

  .timer .date:nth-child(11) {
    margin-right: 10px;
  }

  .left {
    margin-top: 2%;
    margin-left: 1%;
    width: 25%;
    height: 100%;
    background-color: #071022;
  }

  .center {
    margin-top: 2%;
    width: 50%;
    height: 100%;
    background-color: #b4bccc;
  }

  .right {
    margin-top: 2%;
    margin-right: 1%;
    width: 25%;
    height: 100%;
    background-color: #071022;

  }

</style>
